package io.modifier.basic.compose.hooks

import androidx.compose.runtime.Composable
import io.modifier.basic.compose.hooks.comm.SuspendAsyncFn


/** [useUpdateEffect] 用法等同于 [useEffect]，但是会忽略首次执行，只在依赖更新时执行 **/
@Composable
fun useUpdateEffect(vararg deps: Any?, block: SuspendAsyncFn) {
    var isMounted by useRef(false)
    useEffect(*deps) {
        if (!isMounted) {
            isMounted = true
        } else {
            block()
        }
    }
}
